﻿using System.Text.RegularExpressions;

namespace Xms.Abp.Data;

public static class ValidationHelper
{
    public static Regex MobilePhoneRegex = new("^1\\d{10}$");
    public static Regex PhoneRegex = new("^((\\d{3,4}-?)?\\d{7,8})$|^(1\\d{10})$");
    public static Regex EmailRegex = new("^[\\w-]+(\\.[\\w-]+)*@[\\w-]+(\\.[\\w-]+)+$");
    public static Regex NoRegex = new("^[a-zA-Z0-9_-]{2,36}$");
    public static Regex StrongPasswordRegex = new("^.*(?=.{6,16})(?=.*\\d)(?=.*[A-Z])(?=.*[a-z])(?=.*[!@#$%^&*?\\(\\)]).*$");
    public static bool IsValidateMobilePhone(string text)
    {
        return MobilePhoneRegex.IsMatch(text);
    }
    public static bool IsValidatePhone(string text)
    {
        return PhoneRegex.IsMatch(text);
    }
    public static bool IsValidateEmail(string text)
    {
        return EmailRegex.IsMatch(text);
    }
    public static bool IsValidateNo(string text)
    {
        return NoRegex.IsMatch(text);
    }
    public static bool IsValidateStrongPassword(string password)
    {
        return StrongPasswordRegex.IsMatch(password);
    }
}
